import type { App } from 'vue';

// import useFormModal from '@/hooks/useFormModal'
// import useModal from '@/hooks/useModal/index';
import permission from '@/permission';
import { notification } from 'ant-design-vue'

// 定义一个全局方法来显示通知
const showNotification = (message, description) => {
  notification.open({
    message,
    description,
    onClick: () => console.log('Notification Clicked!'),
    // 其他配置项...
  });
};

const isMobile = () => {
  let flag = navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)
  return flag;
}
/**
 * 注册全局方法
 * @param app
 */
export function setupGlobalMethods(app: App) {
  app.use(permission);
  // app.use(useFormModal)
  // app.use(useModal);
  // 全局挂载Reflect反射对象,以便在vue模板中使用
  app.config.globalProperties.Reflect = Reflect;
  app.config.globalProperties.$isMobile=isMobile();
  app.config.globalProperties.$showNotification = showNotification;
}
